package chan.project.smartlawmodel.enums;

import cn.hutool.core.util.ObjectUtil;

import java.util.Arrays;
import java.util.List;
import java.util.stream.Collectors;

public enum TextParseEnum {

    CONTRACT("合同","contract"),
    INSTRUMENT("文书","instrument"),
    CASE("案件","case"),
    OTHER("其它","other");

    private final String name;

    private final String value;

    TextParseEnum(String name,String value){
        this.name = name;
        this.value = value;
    }

    public static List<String> getValues() {
        return Arrays.stream(values()).map(item -> item.value).collect(Collectors.toList());
    }

    public static TextParseEnum getEnumByValue(String value) {
        if(ObjectUtil.isEmpty(value)){
            return null;
        }
        for (TextParseEnum item : values()) {
            if (item.value.equals(value)) {
                return item;
            }
        }
        return null;
    }

    public String getValue() {
        return value;
    }

    public String getName() {
        return name;
    }

}
